package Day05;


import java.util.Random;

public class MethodDemo2 {
    public static void main(String[] args) {



        int a = 7,b = 100;
        int num = sum(a,b);
        System.out.println(num);

        int[] arr,arr2;
        arr = generateArray();
        System.out.println(arr.length);
        System.out.println("----------");
        for (int i=0;i< arr.length;i++){
            System.out.println(arr[i]);
        }

        System.out.println("----------");
        arr2 = generateArray2(a,b);
        System.out.println(arr2.length);
        for(int i=0;i< arr2.length;i++){
            System.out.println(arr2[i]);
        }



    }
    public static int sum(int n1,int n2){
        int num = n1 + n2;
        return num;
    }

    public static int[] generateArray(){
        int n = 6;
        int[] arr = new int[n];
        for (int i=0;i<n;i++){
            arr[i]=(int)(100*Math.random());
        }
        return arr;
    }

    public static int[] generateArray2(int length,int max){
        Random rand = new Random();

        int[] arr = new int[length];
        for (int i=0;i<length;i++){
            arr[i]=rand.nextInt(max+1);
            //arr[i]=(int)(max*Math.random()+1);
        }
        return arr;
    }
}
